package Chapter05.cak;

import java.util.Scanner;

public class EpidemicControl {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int confirmed = 0;
        int suspected = 0;
        int cured = 0;
        int dead = 0;
        while (true) {
            System.out.println("请选择操作：");
            System.out.println("1.录入疫情数据");
            System.out.println("2.展示疫情数据");
            System.out.println("3.退出程序");
            int choice = scanner.nextInt();
            switch (choice) {
                case 1:
                    System.out.println("请输入新增确诊人数：");
                    int newConfirmed = scanner.nextInt();
                    confirmed += newConfirmed;
                    System.out.println("请输入新增疑似人数：");
                    int newSuspected = scanner.nextInt();
                    suspected += newSuspected;
                    System.out.println("请输入新增治愈人数：");
                    int newCured = scanner.nextInt();
                    cured += newCured;
                    System.out.println("请输入新增死亡人数：");
                    int newDead = scanner.nextInt();
                    dead += newDead;
                    System.out.println("数据录入成功！");
                    break;
                case 2:
                    System.out.println("截至目前，累计确诊人数为：" + confirmed);
                    System.out.println("截至目前，累计疑似人数为：" + suspected);
                    System.out.println("截至目前，累计治愈人数为：" + cured);
                    System.out.println("截至目前，累计死亡人数为：" + dead);
                    break;
                case 3:
                    System.out.println("程序已退出！");
                    return;
                default:
                    System.out.println("输入不合法，请重新选择！");
            }
        }
    }}